import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '@/layout'
import Login from '@/views/login'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: Layout,
    redirect: '/commodity',
    children: [
      // 主页
      { path: '/home', component: () => import('@/views/home'), hidden: true },
      // 购物车
      { path: '/gwc', component: () => import('@/views/shopping_cart'), hidden: true, meta: { isRole: true } },
      // 个人中心内容头部
      { path: '/tob', component: () => import('@/views/commodity/gerzhox') },

      // 个人中心
      {
        path: '/personal',
        component: () => import('@/views/personal'),
        redirect: '/personal/rwu',
        title: '个人中心',
        children: [
          { path: '/personal/rwu', component: () => import('@/views/personal/components/rwu'), meta: { isRole: true } },
          { path: '/personal/rwu1', component: () => import('@/views/personal/components/rwu1') },
          { path: '/personal/rwu2', component: () => import('@/views/personal/components/rwu2') },
          { path: '/personal/rwu3', component: () => import('@/views/personal/components/rwu3') },
          { path: '/personal/rwu4', component: () => import('@/views/personal/components/rwu4') },
          { path: '/personal/rwu5', component: () => import('@/views/personal/components/rwu5') },
          { path: '/personal/rwu6', component: () => import('@/views/personal/components/rwu6') },
          { path: '/personal/rwu7', component: () => import('@/views/personal/components/rwu7') },
          { path: '/personal/rwu8', component: () => import('@/views/personal/components/rwu8') },
          { path: '/personal/rwu9', component: () => import('@/views/personal/components/rwu9') },
          { path: '/personal/rwu10', component: () => import('@/views/personal/components/rwu10') },
          { path: '/personal/rwu11', component: () => import('@/views/personal/components/rwu11') },
          { path: '/personal/rwu12', component: () => import('@/views/personal/components/rwu12') },
          { path: '/personal/rwu13', component: () => import('@/views/personal/components/rwu13') },
          { path: '/personal/rwu14', component: () => import('@/views/personal/components/rwu14') },
          { path: '/personal/rwu15', component: () => import('@/views/personal/components/rwu15') },
          { path: '/personal/rwu16', component: () => import('@/views/personal/components/rwu16') }
        ]
      },
      // 个人中心管理
      // {
      // },
      // 详情
      { path: '/details', component: () => import('@/views/details'), hidden: true },
      // 商品
      { path: '/commodity', component: () => import('@/views/commodity'), hidden: true }
    ]
  },
  // 登录
  {
    path: '/login',
    component: Login,
    children: [
      { path: '', component: () => import('@/views/login') }
    ]
  }

]

const router = new VueRouter({
  routes
})

export default router
